function check_registration(dx,dy,template)

figure;
if ~isa(dx,'cell')
    subplot(1,2,1),imagesc(template); colormap gray, axis off, axis tight;
    subplot(1,2,2),plot([dx dy]);
    set(gcf, 'Position',[1 1 800 200]);
else
    nolayers = length(dx);
    
    for ind = 1:nolayers
        subplot(nolayers,2,ind*2-1),imagesc(template{ind}); colormap gray, axis off, axis tight;
        subplot(nolayers,2,ind*2),hold on,
        plot(dx{ind});
        plot(dy{ind},'g');
    end
    set(gcf, 'Position',[1 1 800 200*nolayers]);
end